package com.itheima.crops.dao;

import com.itheima.crops.pojo.Crops;
import com.itheima.crops.pojo.Pcrops;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface PcropsMapper extends Mapper<Pcrops> {

    @Select("select did from t_pcrops_disease where cid = #{cid}")
    public List<Integer> findDidsByCid(Integer cid);

    @Insert({"insert into t_pcrops_disease values (null,#{cid},#{did})"})
    public void addPcropsDiseaseRel(@Param("cid") Long cid, @Param("did")Long did);

    @Delete("delete from t_pcrops_disease where cid = #{cid}")
    public void deletePcropsDiseaseRel(Long cid);

    @Select("select * from t_cust_farmland_crop where name = #{name} and stage = #{stage}")
    public List<Crops> findCropsByNameAndStage(Map hashMap);
}
